package logic

import (
	"context"
	"group-card/model/entity"
	"group-card/rpc/sys/internal/svc"
	"group-card/rpc/sys/sysclient"

	"github.com/zeromicro/go-zero/core/logx"
)

type CustomerDeleteLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCustomerDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CustomerDeleteLogic {
	return &CustomerDeleteLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CustomerDeleteLogic) CustomerDelete(in *sysclient.CustomerDeleteRequest) (*sysclient.CustomerDeleteResponse, error) {
	data := entity.SysCustomerReq{
		Id: in.Id,
	}

	var ctx context.Context
	err := l.svcCtx.CustomerModel.Delete(ctx, &data)

	if err != nil {
		return nil, err
	}

	return &sysclient.CustomerDeleteResponse{}, nil
}
